package com.ruoyi.web.controller.construction.supertube;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.construction.ConstructionInfo;
import com.ruoyi.system.domain.construction.OrderTeam;
import com.ruoyi.system.domain.construction.Team;
import com.ruoyi.system.domain.zhuangxiumain.shopMain.SupplierInfo;
import com.ruoyi.system.service.construction.ConstructionInfoService;
import com.ruoyi.system.service.construction.OrderTeamService;
import com.ruoyi.system.service.construction.TeamService;
import com.ruoyi.system.service.zhaungxiuservice.shopService.SupplierInfoService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 超管施工队店铺接口
 *
 * @author zhangshaocong
 */
@Api(value = "超管施工队店铺接口", tags = {"超管施工队店铺接口"})
@RestController
@RequestMapping("/super/superTeamSupplier")
public class SuperTeamSupplierController extends BaseController {

    @Autowired
    private SupplierInfoService supplierInfoService;

    @Autowired
    private TeamService teamService;

    @Autowired
    private ConstructionInfoService constructionInfoService;

    @Autowired
    private OrderTeamService orderTeamService;

    /**
     * 查询施工队店铺列表
     * @return
     */
    @PreAuthorize("@ss.hasPermi('super:superTeamSupplier:list')")
    @GetMapping("/list")
    public TableDataInfo selectSuperTeamSupplierList(SupplierInfo supplierInfo){
        startPage();
        List<SupplierInfo> list = supplierInfoService.selectSuperTeamSupplierList(supplierInfo);
        return getDataTable(list);
    }

    /**
     * 修改店铺的状态
     * @param supplierInfo
     * @return
     */
    @PreAuthorize("@ss.hasPermi('super:superTeamSupplier:edit')")
    @Log(title = "超管施工队店铺管理", businessType = BusinessType.UPDATE)
    @PutMapping(value = "/changeSuperTeamStatus")
    public AjaxResult changeSuperTeamStatus(@RequestBody SupplierInfo supplierInfo){
        return toAjax(supplierInfoService.changeSuperTeamStatus(supplierInfo));
    }


    /**
     * 查询施工队店铺内部分类列表
     * @return
     */
    @PreAuthorize("@ss.hasPermi('super:superTeam:list')")
    @GetMapping("/superTeamList")
    public TableDataInfo selectSuperTeamList(Team team){
        startPage();
        List<Team> list = teamService.selectSuperTeamList(team);
        return getDataTable(list);
    }

    /**
     * 查询施工队人员信息列表
     * @return
     */
    @PreAuthorize("@ss.hasPermi('super:superTeamInfo:list')")
    @GetMapping("/selectSuperTeamInfoList")
    public TableDataInfo selectSuperTeamInfoList(ConstructionInfo info){
        startPage();
        List<ConstructionInfo> list = constructionInfoService.selectSuperTeamInfoList(info);
        return getDataTable(list);
    }

    /**
     * 查询施工队人员信息列表
     * @return
     */
    @PreAuthorize("@ss.hasPermi('super:superOrderTeam:list')")
    @GetMapping("/selectSuperOrderTeamList")
    public TableDataInfo selectSuperOrderTeamList(OrderTeam orderTeam){
        startPage();
        List<OrderTeam> list = orderTeamService.selectSuperOrderTeamList(orderTeam);
        return getDataTable(list);
    }

}
